package com.my.thread.group;

import com.google.common.base.Throwables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ThreadGroups {
    private static final Logger LOGGER = LoggerFactory.getLogger(ThreadGroups.class);

    public static void main(String[] args) throws Exception {
        ThreadGroup group = new ThreadGroup("search");

        for (int i = 0; i < 10; i++) {
            new Thread(group, new Runnable() {
                @Override
                public void run() {
                    try {
                        Thread.sleep(100 * 1000);
                    } catch (InterruptedException e) {
                        LOGGER.error("exception caught, the error is {}", Throwables.getStackTraceAsString(e));
                    }
                }
            }).start();
        }

        group.interrupt();
    }
}
